package com.pinyougou.shop.controller;

import com.pinyougou.Result;
import com.pinyougou.pojo.TbSeller;
import com.pinyougou.sellergoods.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shop")
public class ShopController {
    @Autowired
    private ShopService shopService;


    @RequestMapping("/add")
    public Result insert (@RequestBody TbSeller Seller){
        //BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        //String encode = passwordEncoder.encode(Seller.getPassword());
        //Seller.setPassword(encode);
        try{
            int num = shopService.add(Seller);
           if (num>0){
               return new Result(true,"注册成功");
           }
        }catch (Exception e){
            e.printStackTrace();

        }
        return new Result(false,"注册失败");
    }
}
